'use strict';

/**
 * @param {Egg.Application} app - egg application
 */
module.exports = app => {
  const { router, controller } = app;
  app.beforeStart(async () => {
    await app.model.sync({force: false,alter:true}); //force  false 为不覆盖 true会删除再创建; alter true可以 添加或删除字段;
  });
  router.get('/', controller.home.index);
  router.post('/', controller.home.show);

  
  router.get('/user/openid', controller.user.show);
  // 更新 
  router.post('/user', controller.user.edit);
  // 获取用户信息
  router.get('/user', controller.user.index);
  // 插件
  router.get('/plug/banner', controller.plug.banner);
  router.post('/plug/banner', controller.plug.editBanner);
  //文章
  router.get('/article', controller.article.index);

  require('./router.admin')(app);

};


